using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ZombieManager : MonoBehaviour
{
    [SerializeField]
    private float createCycle = 10f;
    private float createTimer;
    [SerializeField]
    private List<GameObject> createPointList;


    void Start()
    {
        
    }


    void Update()
    {
        if (createTimer >= createCycle)
        {
            createTimer = 0;
        }
        createTimer += Time.deltaTime;
        if (createTimer >= createCycle)
        {
            CreateZombie();
        }
    }

    void CreateZombie()
    {
        GameObject zombiePrefab = ResourceManager.Instance.Zombie;
        int index = Random.Range(0,4);
        Vector3 position = createPointList[index].transform.position;
        Instantiate(zombiePrefab, position,transform.rotation);
    }

}
